package textEnum;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public enum TextEnum {
    Red("zhangshang",15),White("lisi",17)
    ,Black("wangwu",19);
    private String id;
    private int num;
    private TextEnum(String name,int num){
        //编译器自动插入 super(name,ordinal);
        this.id=id;
        this.num=num;
    }

    public static void main(String[] args) {
        TextEnum[] values = TextEnum.values();
        for (TextEnum x:values) {
            System.out.println(x+" "+x.ordinal());
        }
        TextEnum textEnum =TextEnum.valueOf("Red");
        System.out.println(textEnum);
        System.out.println(Red.compareTo(Black));

    }
    public static void main1(String[] args) {
        TextEnum textEnum = Red;
        switch (textEnum){
            case Red :
                System.out.println("Red");
                break;
            case White:
                System.out.println("White");
                break;
            default:
                System.out.println("无法匹配");
        }
    }
}
